import "cesium/Build/Cesium/Widgets/widgets.css";
import * as Cesium from "cesium";

const InitCesium = {
  init: (ele) => {
    var subdomains = ["0", "1", "2", "3", "4", "5", "6", "7"];
    var imageryProviderTDT = new Cesium.WebMapTileServiceImageryProvider({
      url: "https://t{s}.tianditu.gov.cn/img_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=23c64b6db1d90eaeb7516746514ef956",
      subdomains: subdomains,
      layer: "tdtImage",
      style: "default",
      format: "image/jpeg",
      tileMatrixSetID: "GoogleMapsCompatible",
      show: true,
      maximumLevel: 18,
    });

    var viewer = new Cesium.Viewer(ele, {
      imageryProvider: imageryProviderTDT,
      animation: false,
      baseLayerPicker: false,
      fullscreenButton: false,
      vrButton: false,
      geocoder: false,
      homeButton: false,
      infoBox: false,
      sceneModePicker: false,
      selectionIndicator: false,
      timeline: false,
      navigationHelpButton: false,
      navigationInstructionsInitiallyVisible: false,
      scene3DOnly: true,
    });

    return viewer;
  },
};

export default InitCesium;
